﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Caifu.Clients;
using Itfort.Web;

namespace Caifu.WebSite.Mini
{
	public partial class AllNetDaily : System.Web.UI.Page
	{
		protected int m_i;
		protected string m_Category;

		protected void Page_Load(object sender, EventArgs e)
		{
			m_Category = RequestUtil.ToString("category");
			var dataSource = this.GetNetValueDailys(m_Category);


			this.Repeater1.DataSource = dataSource;
			this.DataBind();
		}

		protected IList<NetValueDaily> GetNetValueDailys(string category)
		{
			var allNetValueDailys = NetValueDailyClient.GetAllNetValueDailys();

			if (String.IsNullOrEmpty(category) || category == "all") return allNetValueDailys;

			List<NetValueDaily> netValueDailys = new List<NetValueDaily>();

			foreach (var item in allNetValueDailys)
			{
				if (!String.IsNullOrEmpty(item.Category) && item.Category.Contains(category))
				{
					netValueDailys.Add(item);
				}
			}

			return netValueDailys;
		}

		public string GetTabCss(string category)
		{
			if (m_Category == category) return "b03";
			return "";
		}
	}
}